package com.huanong.mapper;

import com.huanong.pojo.NewWork;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 新闻管理相关操作的Mapper
 */
@Repository
public interface NewsMapper {

    @Select("select * from newwork")
    List<NewWork> queryNewsWork();

    @Select("select * from newwork where nkid=#{NkId}")
    NewWork queryNewsWorkById(@Param("NkId") Integer NkId);

    @Insert("insert into newwork (nktitle,nkmesage) values(#{NkTitle},#{NkMesage})")
    int addNewsWork(NewWork newWork);

    @Delete("delete from newwork where nkid=#{NkId}")
    int deleteNewsWork(@Param("NkId") Integer NkId);

    @Update("update newwork set nktitle=#{NkTitle},nkmesage=#{NkMesage} where nkid=#{NkId}")
    int updateNewsWork(NewWork newWork);
}
